# Build script for Windows

Write-Host "Building Hysteria Rust..." -ForegroundColor Green

# Build Rust backend
Write-Host "`nBuilding backend..." -ForegroundColor Yellow
cargo build --release

if ($LASTEXITCODE -ne 0) {
    Write-Host "Backend build failed!" -ForegroundColor Red
    exit 1
}

# Build frontend
Write-Host "`nBuilding frontend..." -ForegroundColor Yellow
Set-Location web
npm install
npm run build

if ($LASTEXITCODE -ne 0) {
    Write-Host "Frontend build failed!" -ForegroundColor Red
    exit 1
}

Set-Location ..

Write-Host "`nBuild completed successfully!" -ForegroundColor Green
Write-Host "Binary: target\release\hysteria.exe" -ForegroundColor Cyan
Write-Host "Web files: web\dist" -ForegroundColor Cyan
